from utils.JSON的输入和输出 import 读取json, 写入json

old_json = 读取json('data/已有的翻译JSON/DLG_Text.json')
new_json = 读取json('output/JSON/DLG_Text.json')

json_map = {item['word']: item['trans'] for item in old_json}

for item in new_json:
    if json_map.get(item['word']):
        item['trans'] = json_map.get(item['word'])

写入json(new_json, 'output/JSON/DLG_Text.json')